<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">黑名单导入</ui:define>
    <ui:define name="content">
        <h:form >
            <div class="ui-fluid" style="padding-top: 0px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <p:panelGrid columns="7" layout="grid"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">

                                <p:outputLabel for="blacklist" value="选择黑名单来源"/>
                                <p:selectOneMenu id="blacklist" value="#{userBlacklistBean.type}">
                                    <f:selectItems
                                            value="#{userBlacklistBean.blacklistTypes}"
                                            var="blacklistType"
                                            itemLabel="#{blacklistType.typeName}" itemValue="#{blacklistType.typeCode}"/>
                                </p:selectOneMenu>
                                
                                <p:fileUpload
									fileUploadListener="#{userBlacklistBean.handleBlacklist}"
									mode="advanced" auto="true" 
									sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
									allowTypes="/(\.|\/)(txt)$/" label="选择文件（.txt）"
									invalidFileMessage="文件格式不正确" />
								
								<p:commandButton value="校验文件" update="@form" actionListener="#{userBlacklistBean.onCheck}"/>
								
								<p:commandButton value="导入"  actionListener="#{userBlacklistBean.onSave}" icon="fa fa-upload" update="@form">
									<p:confirm
										header="文件存在#{userBlacklistBean.totalCount}条有效数据"
										message="其中#{userBlacklistBean.repeatCount}条已存在，不导入" />
								</p:commandButton>
								<p:confirmDialog global="true" showEffect="fade" hideEffect="fade" >
							        <p:commandButton value="是" type="button" update="@form"  styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
							        <p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
							    </p:confirmDialog>
                                
							    
                            </p:panelGrid>
                            
                        </div>
                        
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
